Hello there and welcome to this feed you on Javascript events.
Events are peace of course in Britain to listen out for things that are happening within the browser
and then response to that.
For example you can click a button on a website or respond to a question.
When you do that that is an event.
There is a code written underneath that responds when you do something.
For example when you click on a button and a website to do some pain invokes or cause that could cause
a function to perform some pain.
So in this video I'll be creating an event and will show you how that works.
All right.
I have written some code here that we can use to test an event.
All right so start with the hastier Mal's side of things.
So this is the button I have created that I want I want the event to happen.
So this is how you create a button.
You start with a button tag.
There's an opaline tag.
There's a close and tag inside the opening opening button tag.
There is click on click is a function in javascript.
So I've made that click.
That means when you click on something something will happen.
I've made it quarter as I've given it value off quick me of my of my Click me.
So this is the name of the function I have written.
This is the this is my script.
This is the US group side of the page.
So I've written a function and I'm giving the function name called My Click me.
So that's why this function here.
When the button is clicked it will give you a value of my Click me.
My Click me here when you click on that it will execute this piece of could here.
What that does it will get the document documents don't get Hillmen by a day.
What it will do it will get the hastier element by its IDM name.
So if you notice this paragraph here it's got an idea of para saw and it gives you a text or Javascript
can be fun to learn.
So when the page loads this text will be displayed by this paragraph.
What its function is doing when when you click on the button the button will pick will replace this
text here with this.
So that is an event where you click on a button it will replace that text with this text.
So the DOT in a hasty email through referring to this here so was saying get this and change this with
this so let me save this and run this code so you can see
well case this is the this is the code so this is the button here.
So if I click on the button I am responding to an event and the event is driven by the code I have written.
So if I click on this Nick could pay me minimize this page.
Okay so this is the code that will be executed if I click on this button.
Currently the text that it's displayed is this text here.
Jabbers creep can be fun to learn.
So what this function is doing the button unclick means when the button is clicked.
I want you to do this function and this function has a value of its function which is this and the the
value of this function is this here.
So if I click on the button it will get this document by its idea which is power and that paragraph
and replace it with this text using the inner hastier mail.
So let's go ahead and do that.
Click on click me say it is change get to a thank you for taking this course which is this here.
So as replace this text here my base.
This is what an event does.
When you find that you have to click on something on a website you are doing that news in an event.
So that means an event is happening and there is a cord behind the action.
You respond to.
Okay.
So I hope the video can be a script event has giving you some kind of idea of what events are.
Thank you so much for watching.
There are parts of this video you do not understand.
Please feel free to contact me.
I'll be more than happy to explain.
Thank you.
Bye for now.